﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace MultiView
{
	public class CustomViewLocationRazorViewEngine : RazorViewEngine
	{
		public CustomViewLocationRazorViewEngine()
		{
			string ViewRootPath = System.Configuration.ConfigurationManager.AppSettings["ViewRoot"];

			ViewLocationFormats = new[]
			{
			"~/Views/"+ViewRootPath+"/{1}/{0}.cshtml", "~/Views/"+ViewRootPath+"/{1}/{0}.vbhtml",
			"~/Views/"+ViewRootPath+"/Common/{0}.cshtml", "~/Views/"+ViewRootPath+"/Common/{0}.vbhtml"
		};

			MasterLocationFormats = new[]
			{
			"~/Views/"+ViewRootPath+"/{1}/{0}.cshtml", "~/Views/"+ViewRootPath+"/{1}/{0}.vbhtml",
			"~/Views/"+ViewRootPath+"/Common/{0}.cshtml", "~/Views/"+ViewRootPath+"/Common/{0}.vbhtml"
		};

			PartialViewLocationFormats = new[]
			{
			"~/Views/"+ViewRootPath+"/{1}/{0}.cshtml", "~/Views/"+ViewRootPath+"/{1}/{0}.vbhtml",
			"~/Views/"+ViewRootPath+"/Common/{0}.cshtml", "~/Views/"+ViewRootPath+"/Common/{0}.vbhtml"
		};
		}
	}
}